home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr23
/
csmac13a.zip
/
JB-LEARN.MAC
< prev
next >
Wrap
Text File
|
1995-01-22
|
42KB
|
1,153 lines
JB-LEARN
Version 1.1
for {COMMO} Version 6.4X
Copyright (C) 1995, Jeff Bishop
January 22, 1995
Introduction
I have always loved writing {COMMO} macros. My first major
macro project (JBHOST) was just the beginning. I wrote that
and have used it ever since for all kinds of activities.
After examining other telecommunication programs to see what
could be added to {COMMO} I came up with the idea of writing
a automatic learn macro for {COMMO}.
The {COMMO} macro language is very complex. Many users have
been scared of it due to this fact. I thought to myself
"what could I do to make it easier". I decided to write a
macro that would create {COMMO} macros for login activities
(or any activity the user wishes). After weeks of work, JB
Learn was born to satisfy this requirement/need.
What Can JB-Learn do?
JB-Learn has the following features:
- A very solid learn engine to create ready-to-run macros
after learn mode is complete.
- A learn data file capacity to make future learning more
intelligent. The learn macro learns as you use it. This
is a first in the BBS community. Find another learn
engine that can do that (except CS-LEARN for {COMMO}).
The user has complete control as to what it learns.
- The learn data file will process {COMMO} variables for
you. This gives you even more power. This allows for great
flexibility when using CS-MAC since it defines a wealth of
variables that you can use.
- Have complete control of your learning experience. You
make the decisions if you want to. This provides the
ability to correct mistakes that the learn can not
handle. This provides the ability to create very solid
macros. Just think, you tell the teacher what to do and get a
better grade for it.
- Automatic detection of front end mailers. No need to
press <ESCAPE> twice any more (even during learning) as long as
EMSI protocol is being used.
- The learn can automatically try to log you in without
user intervention. This is similar to most other
conventional learn engines available in other
communication programs.
- The ability to add SSLOOK logic in your macros. This will make them
more stream lined for those nagging prompts often seen on BBS's.
- The macro is FREE for your use. The source code is very
well commented for a great learning experience.
Contact Information
I value all of your input. Please contact me with any
suggestions you may have. You can contact me via the following methods:
Jeff Bishop
Mailing Address: 420 E Yavapai RD. NO. H Tucson, AZ 85705
E-Mail Address : JBISHOP@PRIMENET.COM
Voice Phone : 1-602-888-1456 (evenings before 12:00AM EST).
I can also be reached in the COMMO conference in the fidonet
and WME message networks. Post a message to "jeff bishop" and I will
surely respond to it.
Getting JB-Learn Updates
JB-Learn is distributed in two different packages. I am distributing it
as a stand alone package and it is also in the CS-MAC package (version 13
and above). If you are reading this from the CS-MAC archive, this may or
may not be the latest one. Use the information below to get the latest
and greatest version.
If you have access to the internet, you can use ftp to get JB
Learn. Ftp to ftp.primenet.com. Login as anonymous and send
your e-mail address as the password. Once logged in, cd to
/users/j/jbishop/commo. Once here, get the file jbl-*.zip. This
will get you the latest version. You are also welcome to get the latest
version of CS-MAC here as well. Get the file cs*.zip.
If you wish, you can also ftp to ftp.nlbbs.com. Login as anonymous and
send your mail address as password. Once here, cd to /pub/cs-mac.
If you do not have access to the internet, you can log in to
the Demodulator BBS. The phone number is 1-602-290-2807. Use
'COMMO RELEASE' as your first and last name. Use 'guest' as the
password. A menu will be presented to allow you to pick JB-Learn from.
In addition, other {COMMO} products can be downloaded from this menu.
===========================================
{:JB-LEARN}
This is the beginning of the macro. Here is where basic
setup is done to prepare for learn operation.
{NOCARRIER QUIT}
Quit learn if carrier is lost.
{SETVARIABLE JBL_VER,1.1}
Set the version number here.
{SETESCAPE-P0 ENT_LRN}
Define the label to go to when the <ESCAPE> key is pressed at the local
keyboard.
{SETGET ,,L}
Make all keyboard input echo to the local terminal only.
{SETVARIABLE AUTORESP,N}
This variable tells JB-LEARN whether or not to ask for confirmation of
each response found while reading the LEARN.DAT data file.
If it is set to 'Y', the macro will act in a true auto-learn mode.
{SETVARIABLE DATAFILE,%_HOM%learn.dat}
This defines the INI filename used. The default is %_HOM%LEARN.DAT.
{SETVARIABLE ESCAPE_2,~^[~^[}
Define a variable as 2 escapes.
{SETVARIABLE CAPTFILE,%_HOM^(JBLRN^).CAP}
We are defining the name of the temporary capture file used
throughout this macro.
{SETVARIABLE FON_FILE,%_HOM^(JBLRN^).FON}
We are defining the name of the temporary FON file used
throughout this macro.
{SETVARIABLE NOV_MENU,Y}
Set JB-Learn menu in novice mode.
{SETVARIABLE SSLK_CNT,0}
Set the SSLOOK counter to 0.
{SETVARIABLE SSLKAUTO,N}
Set this variable to Y if you want SSLOOKS to be automatically generated
instead of LOOKFOR/SEND pairs. This is only going to happen in the area
that the data file is processed. It will not affect the JB-Learn menu.
{SETVARIABLE WAITTIME,15}
This variable defines the length of time after all modem
activity stops before the learn process starts interacting
with the user. The default is 15 seconds. Change the
definition if you would like. Be careful though to keep it
long enough. Making it too short will have disastrous
affects in the learn engine. If this variable is set as NULL,
then this auto learn type feature is turned off.
{CALL OPEN_CAP}
Open the capture file.
{:LEARNING}
This label begins the learning online process.
We are now going to define the learn robot.
{SETLOOK %WAITTIME}
This defines the setlook timer.
{GOLOOK LEARNING,^M}
The look timer is continuously reset upon seeing a <ENTER>
character. When it is seen, the macro jumps back to the
LEARNING label.
{SSLOOK ESCAPE_2,**EMSI_}
Watch for the EMSI protocol string. When it comes in, send two escapes.
{LOOKFOR <ESC> FOR LEARN MODE}
Show a dummy lookfor and provide information to the user on
the status line.
{:ENT_LRN}
Start parsing the BBS prompt now.
{CAPTURE N}{WOPEN-A %CAPTFILE}{WRITE}{WCLOSE}
Turn off the capture file. Open the capture file to write to (in append
mode). Write a blank line to the file to insure that the capture file
ends with a CR/LF pair. Close the capture file.
{ROPEN %CAPTFILE,ERD}
Open the capture file for reading. Once the capture file has
been read completely, go to the label ERD.
{SETVARIABLE T}{SETVARIABLE LOOK_FOR}
Clear the variables used during the read loop below.
{:RDL}
Enter the capture file read loop to find the BBS prompt.
{READ T}{COMPARE T}{IFCONDITION RDL}
Read a line from the file. If the line is blank, go get another one.
{SETVARIABLE LOOK_FOR,%T}{GOTO RDL}
Set the LOOK_FOR variable to the line read and go get another line from
the file.
{:ERD}
End of file read label definition.
{COMPARE LOOK_FOR}{IFCONDITION ,JBLRNDAT}
We are checking to see if we have found a BBS prompt. If we
have, then control passes to parse the data file. Otherwise,
we will now ask the user to supply a look_for string (BBS prompt).
{CLEAR}{DISPLAY 1,1,,ENTER THE STRING TO LOOK FOR (BBS PROMPT): }
{GETSTRING-I LOOK_FOR,32}
Clear the screen and ask the user to supply a BBS prompt.
{COMPARE LOOK_FOR}{IFCONDITION QUIT}
See if the user entered a BBS prompt. If they did not, leave
the learn macro.
{:JBLRNDAT}
This is the label used to designate processing of the data file.
{SUBSTRING LOOK_FOR,-32,32,%LOOK_FOR}
Grab the last 32 characters of the BBS prompt as the target string.
{COMPARE LRN_MAC}{IFCONDITION ,LOAD_DAT}
If the macro file has already been defined process the data file.
We are now beginning to define the name of the macro file to
write to during learn operation.
{SETVARIABLE LRN_MAC,%_MAC}
We will first set the name of the macro file to the current
{COMMO} macro file name. The user may change it later.
{:DEF_MAC}
The macro entry loop.
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT LRN_MAC,ENTER MACRO FILE TO APPEND TO}
Allow the user to edit the macro name if need be.
{COMPARE LRN_MAC}{IFCONDITION DEF_MAC}
Check and see if the macro is NULL. If it is, go back and
re-enter it.
We are now going to define the label to be used for this
learned macro entry.
This is the start of a routine to remove invalid characters
from the label name. The characters we will remove are the
comma, space, colon, slash, and curly braces
{SETVARIABLE INVALID,, :/^(^)}
This sets the invalid characters that will be stripped from
the system name to make the label name.
{SETVARIABLE COUNT,0}
Initialize a counter that will be used to step through the
system name character by character.
{SETVARIABLE LRN_LBL}
Initialize the macro label
{:XLATE_LOOP}
This is the loop that checks each character and removes
invalid characters.
{INCREMENT COUNT}
Increment the placekeeper that checks each character in the
system name.
{SUBSTRING CH,%COUNT,1,%_NAM}
This takes a character out of the system name (%_NAM) and
puts it in variable %CH
{COMPARE CH}
This is checking for the end of the system name. If we have
reached the end, the variable %CH will be empty.
{IFCONDITION XLATE_DONE}
If the variable %CH was empty, we are done. Otherwise,
continue to see if this is an invalid character.
{INSTRING INVALID,%CH}
Check to see if this character is in the invalid list.
{IFCONDITION XLATE_LOOP}
If it is in the invalid list, loop back.
If this character is not on the invalid list, it will be added
to the label.
{SETVARIABLE LRN_LBL,%LRN_LBL%%CH}
The act of sticking two variables back-to-back like this is
called "concatenating". Variable %LRN_LBL will keep growing until
the end of the system name is reached.
{LENGTH %LRN_LBL}
This gets the length of the %LRN_LBL string and puts it into %_LEN
{COMPARE _LEN,10}
The length of the %LRN_LBL string is compared with the value "10".
{IFCONDITION-E ,XLATE_LOOP}
If the length of the label equals 10, the routine will go to
the next step. If %_LEN does not equal 10, the routine will
return to the top of the loop to get the next character.
{:XLATE_DONE}
Finish processing label definition.
{SETVARIABLE COUNT}{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT LRN_LBL,ENTER LABEL NAME USED FOR THIS MACRO}
Allow the user to edit the label name.
{COMPARE LRN_LBL}{IFCONDITION XLATE_DONE}
Check and see if the label is NULL. If it is, go back and
re-enter it.
{WOPEN-A %LRN_MAC}{WRITE}
Open the macro file and write a blank line to it.
{WRITE ^(:%LRN_LBL^)}
Write the label in the macro file now.
{WRITE ^(SETVARIABLE ESCAPE_2,~^[~^[^)}
Write a variable definition to the macro as 2 escapes.
{WRITE ^(SSLOOK ESCAPE_2,**EMSI_^)}{WRITE}{WCLOSE}
Some BBS programs use a front end mailer. These front end
mailers ask the user to press <ESCAPE> twice to enter the
BBS. This line automatically senses these front end mailers
and will send the <ESCAPE> characters for you. After writing is
done, close the file.
{CLEAR}{DISPLAY 1,1,,DO YOU WANT TO USE AUTO-LEARN MODE (Y/N) [N]? }
{GETSTRING-HI AUTORESP,1}{CLEAR}
Clear the screen. Ask the user if they want to use auto-learn mode.
The only way this feature is turned on is if AUTORESP is set to 'Y'.
{:LOAD_DAT}
Check and see if the BBS prompt has already been seen. If so, generate
the response automatically. Otherwise, begin loading the data file.
{SETVARIABLE COUNT,0}
Initialize the counter to 0
{:CHK_SLOP}
{INCREMENT COUNT}{SETVARIABLE-S T,SLR_%COUNT}
Increment the counter and get the response string for the SSLOOK.
{COMPARE T}{IFCONDITION LOADDAT1}{SETVARIABLE RESP,%T}{SETVARIABLE T}
See if no response is available. If there is not one, end this routine.
{SETVARIABLE-S T,SLT_%COUNT}
Assign the target to the temporary variable.
{INSTRING T,%LOOK_FOR}{IFCONDITION ,CHK_SLOP}
Check and see if this target matches the BBS prompt found. If it does,
process it. If it is not, go get another SSLOOK variable.
{WOPEN-A %LRN_MAC}{WRITE ^(SSLOOK SLR_%COUNT,%LOOK_FOR^)}{WRITE}{WCLOSE}
{INFORM-D1 AUTOMATIC RESPONSE BEING GENERATED ...}{SEND %RESP}
{GOTO CLN_QUIT}
{:LOADDAT1}
{SETVARIABLE COUNT}{SETVARIABLE RESP}{SETVARIABLE T}
{IFEXIST %DATAFILE,OPENDATA}
If the data file does exist, process it. If it does not, ask the user
to supply the name of the data file.
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT DATAFILE,ENTER NAME OF LEARN DATA FILE (LEAVE BLANK TO IGNORE IT):}
Ask the user for the name of the data file.
{COMPARE DATAFILE}{IFCONDITION MENU}
{IFEXIST %DATAFILE,,LOAD_DAT}
See if the variable is blank. If it is, jump to the learn menu. If it
is not, process the newly entered value again.
{:OPENDATA}
This is where the data file is opened.
{ROPEN %DATAFILE,DATA_EOF}
Open the INI file for reading.
{:DAT_LOOP}
Here is where the INI file loop begins.
{SETVARIABLE POS}{SETVARIABLE T}
{SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
Clear all variables used in the loop.
{READ T}
Read a line from the DAT file.
{COMPARE T}{IFCONDITION DAT_LOOP}
{SUBSTRING POS,1,1,%T}{COMPARE POS, }{IFCONDITION DAT_LOOP}
Check to see if the line read is blank. If it is, go get
another. Check and see if the first character in the line is a space.
If it is, get another line.
{INSTRING T,,}
{IFCONDITION ,DAT_LOOP}
Check and see if the line read as a target/response match.
If it is not, go get another.
{SETVARIABLE POS,%_POS}
Set the position found to POS.
{INCREMENT POS,1}
Increment the position variable by 1.
{SUBSTRING TARGET,%POS,255,%T}
Get the target string from the line read from the INI file.
{COMPARE TARGET}{IFCONDITION DAT_LOOP}
Check and see if the target is blank. If it is, get another
line from the INI file.
{INSTRING LOOK_FOR,%TARGET}
Look to see if this defined target exists in the BBS prompt
defined earlier.
{IFCONDITION ,DAT_LOOP}
Check and see if this target matches anything in the BBS
prompt. If it does not, processing returns for another line
out of the INI file.
{DECREMENT POS,2}
Decrement the position variable defined earlier by 2.
{SUBSTRING RESPONSE,1,%POS,%T}
Get the response string from the data out of the INI file.
{COMPARE RESPONSE}{IFCONDITION DAT_LOOP}{RCLOSE}
Close the INI file.
{:DATA_EOF}
This label is the label used after the INI file is closed.
{COMPARE RESPONSE}{IFCONDITION MENU}
See if the response is blank. If it is, jump to the learn menu.
{SUBSTRING T,1,1,%RESPONSE}
Look at the first character of the response.
{COMPARE T,%%}
Is the first character of the response a "%"?
Notice using two %'s in order to represent a literal "%"
{IFCONDITION ,CONFGUES}
If the first character of the RESPONSE indicates that it is a
Commo variable, we will proceed to translate the variable into
it's literal expression. For example, %NAME will be converted
to "Jeff Bishop".
If the first character of the RESPONSE isn't a "%", jump to
the menu that asks you to confirm the response before sending it.
That menu is located at label :CONFGUES
{SUBSTRING RESPONSE,2,200,%RESPONSE}
The first step in the translation is to strip off the leading
"%" character. Notice that this command substrings a variable
back into itself.
{INSTRING RESPONSE,|}
The next step is to check the response variable for presence
of a "pipe" character. The macro assumes that the pipe would
only appear as the last character of a response.
{IFCONDITION-C STRIP-PIPE}
If the response variable has a pipe character in it, we are
going to call a routine to strip it off. Otherwise, we will
continue on our translation journey directly. To make the
IFCONDITION function perform a "call", the "-C" switch is
used. If we strip off the "pipe", we will add it back on
after performing the translation step.
{SETVARIABLE-S T,%RESPONSE}
This single step translates the variable name into the
contents of the variable name. Fred Brucker's explanation
in MACRO.DOC is very good (hint to read the docs).
Basically, this is a two step setvariable function. Step one
expands the %response to make this example command
Step 1 (setvariable t,%name) ;%t=name
Step 2 performs the above command ;%t=Jeff Bishop
{COMPARE T}
Now checking if you have %name (for example) defined. If
you haven't defined a variable in Commospace, %T will now
be NUL. This would be a disaster to the continuation
of the learn macro.
{IFCONDITION-C N_VARDEF}
If the response is NUL, we are going to call a routine to ask
you to define it. Otherwise, we will proceed with the
translation.
{SETVARIABLE RESPONSE,%T}
This command moves the contents of %T into %RESPONSE, and we are
assured that %T is not NUL ... therefore %RESPONSE is not NUL.
{COMPARE STRIPT}
Now checking if we earlier made a trip to the routine that
strips off a trailing "pipe" character. If %stript is NUL,
it means we didn't make the trip to :STRIP-PIPE
{IFCONDITION CONFGUES}
If %stript is NUL, meaning we didn't strip off a trailing
"pipe", then jump to the routine that asks you to confirm the
response before it is sent. Translation is complete.
If %stript contains a value, it means that we DID make a trip
to the :STRIP-PIPE routine. If that is the case, our
translation isn't complete yet, we have to add the "pipe"
back onto the response.
{SETVARIABLE RESPONSE,%RESPONSE|}
This simply puts the "pipe" character back on the translated
variable (turning %name| into Jeff Bishop|).
{SETVARIABLE STRIPT}
This clears the variable that was used to indicate that we had
made a call to :STRIP-PIPE
{GOTO CONFGUES}
Translation is complete. Go to the routine that asks you to
confirm the response before it is sent.
{:STRIP-PIPE}
This label is the start of a routine to remove a trailing "|"
from a variable. The command that happened just before coming
here was (instring response,|). We are here because the
answer to that was "YES", there IS a "pipe" in %RESPONSE.
{SETVARIABLE LEN,%_POS}
This puts the position of the "|" (given by the instring
function as %_pos) into %len. Commo does not provide for
tampering with the %_pos variable.
{DECREMENT LEN,1}
{SUBSTRING RESPONSE,1,%LEN,%RESPONSE}
These two commands strip the last character from the
%RESPONSE variable, in this case we have stripped a "|".
{SETVARIABLE STRIPT,Y}
This sets a variable that we will later use to replace the
character that we stripped off with this routine.
{RETURN}
This is the end of the :STRIP-PIPE subroutine. Return to
the place called from.
{:N_VARDEF}
This label is the start of a routine that prompts you for a
setting for a variable. This routine is called when a
variable appears in the LEARN.DAT file and that variable
isn't found in the currently defined Commo variables.
Typically, these variables would be %name and %_pas.
{CLEAR}
{DISPLAY 1,1,,Input a value for %%%response: }
The first two % signs cause a % to be displayed. The third
one causes %response to be displayed as its value.
An example result .... "Input a value for %name: "
{GETSTRING-I %%RESPONSE}
This simple looking command is a very powerful command.
Notice that there are two % signs. This means, in this
example, that we are getting a value for %name. The "-I"
switch restricts input to the keyboard, if the host system
sends anything, it will be ignored.
{COMPARE %%RESPONSE}
Checking to make sure that you have put a value in for this
variable. Have you a value for %name?
{IFCONDITION N_VARDEF}
If %%response (in example, %name) is NUL, repeat the routine
until you put in a value.
{SETVARIABLE-S T,%RESPONSE}
This is similar to the command that was used in the primary
translation routine. By example, it first "expands" %response
to %name, then it sets %T=contents of %name.
{RETURN}
This is the end of the routine that asks you to define a variable.
This label marks the end of reading the INI file and making any necessary
variable translations.
{:CONFGUES}
This is the start of a menu that asks you to confirm your response to
this BBS prompt.
{COMPARE AUTORESP,Y}{IFCONDITION RITERESP}
See if the user does not want to get prompted.
{CLEAR}
{DISPLAY 1,1,,BBS PROMPT: %LOOK_FOR}
Clear the screen and show the BBS prompt.
{COMPARE RESPONSE,%_PAS|}{IFCONDITION ,C_GUESS1}
{DISPLAY 2,1,,RESPONSE STRING : ^(PASSWORD^)}{GOTO GUESSCHK}
{:C_GUESS1}
{DISPLAY 2,1,,RESPONSE STRING : %RESPONSE}
{:GUESSCHK}
{DISPLAY 4,1,,IS THIS RESPONSE CORRECT (Y/N) [N]? }
Display the response and target strings and ask if the
response is correct.
{GETSTRING-HI KEY,1,MENU}
Get keyboard input. If the user presses <ENTER> controls passes to the
learn menu.
{COMPARE KEY,Y}{IFCONDITION ,MENU}
If the user presses N control will pass to the learn menu.
{COMPARE SSLK_CNT,15}{IFCONDITION-L ,RITERESP}
{COMPARE SSLKAUTO,Y}{IFCONDITION RITESSLK}
See if the SSLOOK count is less than 15. If it is, continue. If it is
not, bypass SSLOOK logic.
{CLEAR}
{DISPLAY 1,1,,DEFINE THIS AS A SSLOOK STRING COMBINATION (Y/N) [N]? }
{GETSTRING-HI KEY,1,RITERESP}
Get keyboard input. If the user presses <ENTER> controls passes to the
normal LOOKFOR/SEND macro method.
{COMPARE KEY,Y}{IFCONDITION ,RITERESP}
If the user presses N control will pass to the LOOKFOR/SEND macro logic.
{:RITESSLK}
{INCREMENT SSLK_CNT}
Increment the SSLOOK counter.
{SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
{SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
Build the SSLOOK strings.
{WOPEN-A %LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
{WRITE ^(SSLOOK SLR_%SSLK_CNT,%LOOK_FOR^)}{WRITE}{WCLOSE}{GOTO RITEDONE}
Write the variable definition and the SSLOOK to the macro file. Continue
macro execution.
{:RITERESP}
{WOPEN-A %LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}
{WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}{SETVARIABLE SSLK_CNT,0}
Open the macro file. Write the commands to it. After doing
so, close the macro file. Reset the SSLOOK counter to 0.
{:RITEDONE}
{COMPARE T,%%_PAS}{IFCONDITION ,GUES_END}
{PASSWORD}{SEND |}{GOTO CLN_QUIT}
{:GUES_END}
{SEND %RESPONSE}{GOTO CLN_QUIT}
Send the response string now. Clean up now.
{:MENU}
This label begins the learn menu.
{CLEAR}
{COMPARE NOV_MENU,Y}{IFCONDITION ,MENU1}
{DISPLAY 1,1,,JB-LEARN RESPONSE TYPE MENU - VERSION %JBL_VER}
{DISPLAY 2,1,,BBS PROMPT: %LOOK_FOR}
{DISPLAY 4,1,,C - CONTINUE LEARNING}
{DISPLAY 6,1,,E - SEND <ENTER>}
{DISPLAY 8,1,,F - BYPASS FRONT END BBS MAILER WITH TWO <ESCAPES>}
{DISPLAY 10,1,,H - TREAT AS A SINGLE KEY HOT KEY (NO <CR>)}
{DISPLAY 12,1,,I - INSERT COMMENT INTO MACRO}
{DISPLAY 13,1,,L - TREAT AS A SSLOOK STRING: (SSLOOK COUNT %SSLK_CNT)}
{DISPLAY 15,1,,P - TREAT AS A PASSWORD}
{DISPLAY 16,1,,Q - QUIT JB-LEARN}
{DISPLAY 18,1,,R - REVISE/EDIT BBS PROMPT}
{DISPLAY 20,1,,S - ENTER STANDARD BBS RESPONSE (WITH <CR>)}
{DISPLAY 22,1,,W - SET WAIT TIME: %WAITTIME}
{DISPLAY 23,1,,X - TOGGLE BETWEEN NOVICE AND EXPERT MENU}
{DISPLAY 24,1,,ENTER CHOICE: C,E,F,H,I,L,P,Q,R,S,W,X: }
Clear the screen and display the menu.
{GOTO MENU2}
{:MENU1}
{DISPLAY 1,1,,ENTER CHOICE: C,E,F,H,I,L,P,Q,R,S,W,X: }
{:MENU2}
{GETSTRING-HI KEY,1,MENU}
Prompt for keyboard input. If <ENTER> is pressed by itself,
control passes to the label shown at the end of the line.
{COMPARE KEY,C}{IFCONDITION CLN_QUIT}
{COMPARE KEY,E}{IFCONDITION JBL_SNCR}
{COMPARE KEY,F}{IFCONDITION FRONTEND}
{COMPARE KEY,H}{IFCONDITION JBL_HKEY}
{COMPARE KEY,I}{IFCONDITION INS_CMNT}
{COMPARE SSLK_CNT,15}{IFCONDITION-L ,MENU3}
{COMPARE KEY,L}{IFCONDITION D_SSLOOK}
{:MENU3}
{COMPARE KEY,P}{IFCONDITION JBL_PASS}
{COMPARE KEY,Q}{IFCONDITION QUIT}
{COMPARE KEY,R}{IFCONDITION EDITBPMT}
{COMPARE KEY,S}{IFCONDITION JBL_STD}
{COMPARE KEY,W}{IFCONDITION WAITTIME}
{COMPARE KEY,X}{IFCONDITION ,MENU}
{COMPARE NOV_MENU,Y}{IFCONDITION MENU4}
{SETVARIABLE NOV_MENU,Y}{GOTO MENU}
{:MENU4}
{SETVARIABLE NOV_MENU,N}
Check for each option on the menu to see if the user
selected it and branch accordingly.
{GOTO MENU}
None of the options matched the key pressed, re-display the
menu.
{:JBL_SNCR}
Send <ENTER> label.
{WOPEN-A %LRN_MAC}
{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND |^)}{WRITE}{WCLOSE}
{SETVARIABLE SSLK_CNT,0}
Open the macro file. Write the command to look for the BBS
prompt followed by a command to send the <ENTER> key. The
file is then closed.
{SEND |}{SETVARIABLE RESPONSE,|}{GOTO CLEAN_UP}
Send the <ENTER> out to the BBS now and clean up after that.
{:FRONTEND}
Send escape characters to bypass front end mailers.
{SEND %ESCAPE_2}{GOTO CLN_QUIT}
{:JBL_HKEY}
Process hot key entries.
{CLEAR}
Clear the screen.
{DISPLAY 1,1,,ENTER THE KEY TO SEND TO THE HOST: }
Prompt the user for a key.
{GETSTRING-HI KEY,1,MENU}
Get keyboard input. If the user presses <ENTER>, then
control passes back to the main learn menu.
{WOPEN-A %LRN_MAC}
{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %KEY^)}{WRITE}{WCLOSE}
Open the macro file and write the two commands to the file.
Close the file.
{SETVARIABLE SSLK_CNT,0}{SEND %KEY}{SETVARIABLE RESPONSE,%KEY}
{GOTO CLEAN_UP}
Send the key to the BBS and clean up after it.
{:INS_CMNT}
Insert comment into macro file.
{INPUT T,ENTER A COMMENT TO PLACE INTO THE MACRO FILE: }
Prompt the user for a comment.
{WOPEN-A %LRN_MAC}{WRITE}{WRITE %T}{WRITE}{WCLOSE}
Open the macro file and write the comment to the file.
Close the file.
{SETVARIABLE T}{GOTO CLN_QUIT}
{:D_SSLOOK}
Define a SSLOOK definition for the macro.
{SETVARIABLE RESPONSE}
Clear out the variable that is going to be used.
{INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
Ask the user to enter a string.
{CLEAR}
{DISPLAY 1,1,,DO YOU WANT A <CR> SENT WITH THIS STRING (Y/N) [N]? }
{GETSTRING-HI CH,1,SSLKCONT}
Ask the user if he/she would like to have a <CR> attached to the entered
string.
{COMPARE CH,Y}{IFCONDITION ,SSLKCONT}
Check and see if the answer is 'Y'. If it is not, skip adding the <CR>.
{SETVARIABLE RESPONSE,%RESPONSE|}
Add the <CR> to the response.
{:SSLKCONT}
{COMPARE RESPONSE}{IFCONDITION ,SSLKCON1}
If the user enters no data, return to the menu.
{INFORM-D1 NO RESPONSE ENTERED - RETURNING TO LEARN MENU ...}{GOTO MENU}
{:SSLKCON1}
{INCREMENT SSLK_CNT}
Increment the SSLOOK counter.
{SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
{SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
Build the SSLOOK strings.
{WOPEN-A %LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
{WRITE ^(SSLOOK SLR_%SSLK_CNT,%look_for^)}{WRITE}{WCLOSE}
Write the variable definition and the SSLOOK to the macro file.
{SEND %RESPONSE}{SETVARIABLE CH}{SETVARIABLE RESPONSE}{CLEAR}
{GOTO CLN_QUIT}
Send the string to the system and clear variables. Begin learning again
after doing that.
{:JBL_PASS}
Process as a password.
{COMPARE _PAS}{IFCONDITION ,PASS1}
Check and see if the password has been defined from the
dialing directory. If it has, jump to the label shown.
Otherwise, we need to enter one.
{CLEAR}
{DISPLAY 1,1,,ENTER YOUR PASSWORD: }
Clear the screen and prompt the user for a password.
{GETSTRING-IP RESPONSE,,MENU}
Get keyboard input. If the user just presses <ENTER>, then
control passes back to the menu.
{SETVARIABLE T,^(SEND %RESPONSE|^)}
{GOTO JBL_PCNT}
Jump to this label.
{:PASS1}
Set password from dialing directory.
{SETVARIABLE T,^(PASSWORD^) ^(SEND |^)}
{:JBL_PCNT}
Process password in macro file and send it out to the BBS.
{WOPEN-A %LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE %T}{WRITE}{WCLOSE}
Open the macro file. Write the command strings to the macro.
Close the macro file.
{SETVARIABLE SSLK_CNT,0}{COMPARE _PAS}{IFCONDITION JBLPCNT2}
{PASSWORD}{SEND |}{GOTO CLN_QUIT}
{:JBLPCNT2}
{SEND %RESPONSE|}{GOTO CLN_QUIT}
Send the password out to the BBS. Clean up after it.
{:JBL_STD}
Process standard BBS response (with <ENTER> at end).
{SETVARIABLE RESPONSE}
Clear out the variable that is going to be used.
{INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
Ask the user to enter a string.
{COMPARE RESPONSE}{IFCONDITION MENU}
If the user enters no data, return to the menu.
{setvariable response,%response|}
Add a <CR> to the response.
{WOPEN-A %LRN_MAC}
{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}
Open the macro file. Write the command strings to it and
close the macro file.
{SETVARIABLE SSLK_CNT,0}{SEND %RESPONSE}{GOTO CLEAN_UP}
Send the entered string to the BBS. Clean up now.
{:EDITBPMT}
Edit BBS prompt.
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT LOOK_FOR,ENTER/EDIT THE BBS PROMPT}
Allow the user to edit the BBS prompt found.
{COMPARE LOOK_FOR}{IFCONDITION QUIT}{GOTO MENU}
If the BBS prompt is blank, leave JB-learn macro. Return to the menu.
{:OPEN_CAP}
Open capture file.
{EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
Check and see if the capture file exists. If it does, delete it.
{CAPMODE FILTER}
Set the capture mode to filter.
{CAPTURE Y,%CAPTFILE}{RETURN}
Open the capture file and return.
{:WAITTIME}
Wait timeout entry.
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT WAITTIME,ENTER THE NUMBER OF SECONDS TO WAIT UNTIL MENU?}
{GOTO CLN_QUIT}
Ask the user for information as shown above. Once input is done, clean up.
{:CLEAN_UP}
The clean up routine.
{SETVARIABLE KEY}{CLEAR}
{DISPLAY 1,1,,ADD THIS RESPONSE/TARGET COMBO TO THE DATA FILE (Y/N) [N]? }
Clear the screen and ask the user if he/she would like to add this
response/target to the data file.
{getstring-hi key,1,CLN_QUIT}
Get keyboard input
{compare key,Y}{ifcondition ,cln_quit}
If the user answers Y the append will happen. If they do not the quit
will continue without writing to the data file.
{WOPEN-A %DATAFILE}{WRITE %RESPONSE,%LOOK_FOR}{WCLOSE}
Write the new response/BBS prompt combination to the data file.
{:CLN_QUIT}
{CALL OPEN_CAP}{GOTO LEARNING}
Open the capture file and return to learn mode.
{:ADD_FON}
Add dialing directory entry to dialing directory for new learn macro.
{CLEAR}
{DISPLAY 1,1,,ADD A NEW ENTRY TO YOUR DIALING DIRECTORY (Y/N) [N]? }
{GETSTRING-HI KEY,1}
Ask the user if they would like to add a new dialing directory entry.
{COMPARE KEY,Y}{IFCONDITION ,RETURN}
Check and see if the user wishes to do this. If not, quit the adding
routine.
{SETVARIABLE SYS_NAME,%_NAM}
Set the variable to the system name (if known) by COMMO.
{COMPARE SYS_NAME}{IFCONDITION ,GETNAM1}
See if the system name is known now.
{SETVARIABLE SYS_NAME,%LRN_LBL}
Set the system name to the value defined for the label in the macro
file written during learn mode.
{:GETNAM1}
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT SYS_NAME,ENTER THE SYSTEM NAME FOR YOUR DIALING DIRECTORY ENTRY: }
Make the user verify their system name before continuing
{COMPARE SYS_NAME}{IFCONDITION RETURN}
See if the user left the system name blank. If he/she did then exit add.
{SETVARIABLE FONENTRY,%SYS_NAME (WITH LEARN) %_MON/%_DAY/%_YEA ^(}
Start building the dialing directory entry string here.
{:GETNUM0}
This label denotes the beginning of processing the phone number to be
dialed.
{SETVARIABLE T,%_NUM}
Set the variable to the value known by COMMO's internal variable.
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT T,ENTER THE SYSTEM'S PHONE NUMBER: }
Ask the user to confirm the phone number.
{COMPARE T}{IFCONDITION GETNUM0}
If the phone number is blank (or edited blank), ask for the number again.
{SETVARIABLE FONENTRY,%FONENTRY%%T^) ^(}
Continue building the dialing directory entry string.
{:GETPAS0}
We are now going to process the password.
{COMPARE _PAS}{IFCONDITION GETPAS1}
See if the password is defined from a linked dialing directory entry.
If it is not, we will get a password from the user.
{SETVARIABLE FONENTRY,%FONENTRY%%_PAS^) ^(}{GOTO ADD_MACRO}
Add the password to the dialing directory entry since we know the
password. Jump to process the macro piece of the dialing directory
entry.
{:GETPAS1}
This label begins asking the user for a password.
{CLEAR}
{DISPLAY 1,1,,ENTER YOUR PASSWORD USED ON THIS SYSTEM: }
Clear the screen and prompt the user for a password.
{GETSTRING-IP T}{CLEAR}
Get the password from the user.
{SETVARIABLE FONENTRY,%FONENTRY%%T^) ^(}
Add the password to the dialing directory entry.
{:ADD_MACRO}
This label starts the preparation and completion of writing to the
dialing directory.
{SETVARIABLE FONENTRY,%FONENTRY%%LRN_LBL,%LRN_MAC^) ^(^)}
Complete the dialing directory entry string here.
{EXECUTE-S COPY %_HOM%%_FON %FON_FILE>NUL}
Make a copy of your dialing directory.
{IFEXIST %FON_FILE,,RETURN}
Check and see if the copy was done correctly. If it was not, end the
routine.
{ROPEN %FON_file,FON_FIN0}{WOPEN %_HOM%%_FON}
Open the COMMO dialing directory and the temporary file to write to here.
{SETVARIABLE COUNT,0}
Reset the counter to 0.
{:ADD_RWL}
Here is where the read loop begins.
{READ T}{WRITE %T}
Read a line from the dialing directory and write it out to the
temporary file.
{COMPARE COUNT,1}{IFCONDITION-E ADD_RWL}
Check and see if we have already written a line to the temporary for
the new entry. If so, just keep reading and writing.
{INSTRING T,%SYS_NAME}{IFCONDITION ,ADD_RWL}
Check and see if the line read is our system name.
If it is not, go get another.
{INCREMENT COUNT}{WRITE %FONENTRY}{GOTO ADD_RWL}
Increment the counter. Write the new dialing directory entry
and go get another line.
{:FON_FIN0}
This label is jumped to when the last line is read from .FON directory.
{COMPARE COUNT,1}{IFCONDITION-E ADD_END}
See if we have already written the newly created dialing directory
entry. If we have, skip to the label shown.
{WRITE %FONENTRY}
Write the new dialing directory entry.
{:ADD_END}
{WCLOSE}{RETURN}
Close the temporary file.
{:QUIT}
Quit routine.
{NOCARRIER}{EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
Reset the NOCARRIER macro function. Check and see if the capture file
exists. If it does, delete it.
{COMPARE LRN_MAC}{IFCONDITION Q_RESET}{IFEXIST %LRN_MAC,,q_reset}
If no macro has been started, jump to the end of the quit routine.
{COMPARE LOOK_FOR}{IFCONDITION QUIT1}
{WOPEN-A %LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE}{WCLOSE}
Write one last LOOKFOR for the ending BBS prompt if one exists.
{:QUIT1}
CLEAR SSLOOK VARIABLES OUT OF {COMMO} VARIABLE SPACE.
{SETVARIABLE T}{SETVARIABLE COUNT,0}
Clear variables and get counter ready for loop below.
{:SSLKLOOP}
This is the loop that will clear those variables defined during the
learn. Clearing commands will also be written to the macro file.
{INCREMENT COUNT}
Increment the SSLOOK counter.
{SETVARIABLE-S T,SLR_%COUNT}
Find out if a value is available for this variable.
{COMPARE T}{IFCONDITION END_MACR}
If there is not, stop processing the loop.
{WOPEN-A %LRN_MAC}{WRITE ^(SETVARIABLE SLR_%COUNT^)}{WCLOSE}
Open the macro file and write code to clear this variable out.
{SETVARIABLE SLR_%COUNT}{SETVARIABLE SLT_%COUNT}{GOTO SSLKLOOP}
Clear this variable and go get another one if it is available.
{:END_MACR}
{WOPEN-A %LRN_MAC}
{WRITE ^(SETVARIABLE ESCAPE_2^)}
{WRITE ^(INFORM-D1 LOGIN COMPLETE^)}{WRITE ^(STOP^)}{WCLOSE}
Open the macro file. Write the ending commands to the macro file.
Close the macro file.
{:Q_RESET}
{CALL ADD_FON}
Add an entry to your dialing directory for this learn macro script just
created.
Reset all variables used during learn operation.
{CLEAR}{SETVARIABLE ESCAPE_2}{SETVARIABLE CAPTFILE}{SETVARIABLE WAITTIME}
{SETVARIABLE KEY}{SETVARIABLE DATAFILE}{SETVARIABLE LOOK_FOR}
{SETVARIABLE LRN_MAC}{SETVARIABLE POS}{SETVARIABLE T}{SETVARIABLE CMD}
{SETVARIABLE AUTORESP}{SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
{SETVARIABLE COUNT}{SETVARIABLE INVALID}{SETVARIABLE CH}
{SETVARIABLE FONENTRY}{SETVARIABLE FON_FILE}{SETVARIABLE LRN_LBL}
{SETVARIABLE SYS_NAME}{SETVARIABLE SSLK_CNT}{SETVARIABLE NOV_MENU}
{SETVARIABLE SSLKAUTO}{INFORM-D1 JB-LEARN VERSION %JBL_VER IS COMPLETE}{}
Inform the user that processing is complete and stop macro execution.
{:RETURN}{RETURN}